package com.ruitu.mall_98_1.product.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.beanu.arad.base.my_base.Config;
import com.beanu.arad.base.my_base.base_list.ListBaseAdapter;
import com.beanu.arad.base.my_base.base_list.SuperViewHolder;
import com.ruitu.mall_98_1.R;
import com.ruitu.router_module.bean.product.Company;
import com.ruitu.router_module.utils.GlideUtil;

//企业列表adpter
public class ShopListAdapter extends ListBaseAdapter<Company> {
    public ShopListAdapter(Context context) {
        super(context);
    }

    @Override
    public int getLayoutId() {
        return R.layout.pro_item_company_list;
    }

    @Override
    public void onBindItemHolder(SuperViewHolder holder, int position) {
        ImageView icon = holder.getView(R.id.icon);
        TextView tv_name = holder.getView(R.id.tv_name);
        TextView tv_num = holder.getView(R.id.tv_num);
        TextView tag_zidingyi = holder.getView(R.id.tag_zidingyi);

        Company com = mDataList.get(position);
        tv_name.setText(com.getName());
        tv_num.setText("在售商品" + com.getTotalGoods() + "件");
        GlideUtil.loadImg(Config.BASE_URL + com.getImageUrl(), icon);
        if (TextUtils.isEmpty(com.getTagName())) {
            tag_zidingyi.setVisibility(View.GONE);
        } else {
            tag_zidingyi.setVisibility(View.VISIBLE);
            tag_zidingyi.setText(com.getTagName());
        }
    }
}
